package com.woniuxy.java106crm.service.impl;

import com.woniuxy.java106crm.entity.CustomerTrade;
import com.woniuxy.java106crm.mapper.CustomerTradeMapper;
import com.woniuxy.java106crm.service.CustomerTradeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CustomerTradeServiceImpl implements CustomerTradeService {

    @Resource
    private CustomerTradeMapper customerTradeMapper;

    @Override
    public List<CustomerTrade> findAllByCid(String cid) {
        return customerTradeMapper.findAllByCid(cid);
    }

    @Override
    public boolean deleteById(String id) {
        return customerTradeMapper.deleteById(id);
    }

    @Override
    public boolean addTrade(CustomerTrade customerTrade) {
        return customerTradeMapper.addTrade(customerTrade);
    }

    @Override
    public boolean updateTrade(CustomerTrade customerTrade) {
        return customerTradeMapper.updateTrade(customerTrade);
    }

    @Override
    public void batchedDelByIdsv(String ids) {
        String[] splits = ids.split(",");
        for (String id: splits) {
            customerTradeMapper.deleteById(id);
        }
    }
}
